import cv2

def showImg(name, img):
    # 将显示图片封装成函数
    cv2.imshow(name, img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

if __name__ == '__main__':
    img = cv2.imread('images/1.jpg')
    cv2.imshow('img', img)
    key = cv2.waitKey(5000)
    # 销毁窗口
    if key & 0xFF == ord("q"):
      cv2.destroyAllWindows()

